home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
misc
/
emu
/
ATUtilities.lha
/
ATUtilities
/
BASIC
/
GEMDOS.BAS
< prev
next >
Wrap
BASIC Source File
|
2000-09-26
|
9KB
|
450 lines
$INCLUDE "REGNAMES.INC"
$STACK 32000
call InitScreen(20)
call MenuGadget(6,"Projekt",100)
call MenuGadget(20,"Einstellungen",200)
call MenuGadget(40,"Testmen",300)
call MenuGadget(60,"Gadget entfernen",400)
q=0
for y=4 to 12 step 2
call BoolGadget(10,y,30,1,"Boolean-Gadget",q)
q=q+1
next
q=20
for y=14 to 24 step 2
call ToggleGadget(10,y,30,1,"Toggle-Gadget",y mod 3,q)
q=q+1
next
dim Feld1$(20)
dim Feld2$(30)
dim Feld3$(30)
Feld1$(0)="Datei laden"
Feld1$(1)="Datei speichern"
Feld1$(2)="Datei speichern als"
Feld1$(3)="-"
Feld1$(4)="Datei lschen"
Feld1$(5)="Datei kopieren"
Feld1$(6)="Datei verschieben"
Feld1$(7)="Datei umbenennen"
Feld1$(8)="-"
Feld1$(9)="Information"
Feld1$(10)="-"
Feld1$(11)="Netzwerk"+chr$(0)
Feld1$(12)="-"
Feld1$(13)="Ende"
for i=0 to 30
Feld2$(i)=" Menpunkt Nummer"+str$(i+1)
Feld3$(i)=chr$(251)+" Menu-Item "+str$(i+1)
next
call MouseOn
while inkey$=""
call MouseDown
if mouse.button<>0 then call MouseHandler
if gad.id<>-1 then
if gad.number(gad.id)=100 then
call MenuHandler(6,200,Feld1$(),14)
end if
if gad.number(gad.id)=200 then
call MenuHandler(20,200,Feld2$(),16)
end if
if gad.number(gad.id)=300 then
call MenuHandler(40,150,Feld3$(),25)
end if
if gad.number(gad.id)=400 then
if gad.count>3 then
call RemoveGadget(gad.count-1)
end if
end if
color 15
locate 5,1:?"G:";gad.number(gad.id)
locate 6,1:?"$:";gad.id
locate 7,1:?"M:";menu.id
end if
gad.id=-1
menu.id=-1
wend
call MouseOff
end
sub DrawPBorder(xo,yo,wo,ho,t$) static
x=xo*8-2 : w=wo*8
y=yo*16-4 : h=ho*16+4
line (x,y+h)-(x,y),15
line -(x+w,y),15
line (x+w,y+1)-(x+w,y+h),7
line -(x+1,y+h),7
locate yo+1,xo+3
color 15
print t$
end sub
sub DrawNBorder(xo,yo,wo,ho,t$) static
x=xo*8-2 : w=wo*8
y=yo*16-4 : h=ho*16+4
line (x,y+h)-(x,y),7
line -(x+w,y),7
line (x+w,y+1)-(x+w,y+h),15
line -(x+1,y+h),15
locate yo+1,xo+3
color 15
print t$
end sub
sub MouseOn static
reg %ax,&H0001
call interrupt &H33
end sub
sub MouseOff static
reg %ax,&H0002
call interrupt &H33
end sub
sub MouseDown shared
reg %ax,&H0005
reg %bx,0
call interrupt &H33
mouse.x=reg(%cx)
mouse.y=reg(%dx)
mouse.button=reg(%BX)
reg %ax,&H0006
reg %bx,0
call interrupt &H33
end sub
sub MouseUp shared
reg %ax,&H0006
reg %bx,0
call interrupt &H33
mouse.x=reg(%cx)
mouse.y=reg(%dx)
mouse.button=reg(%BX)
end sub
sub MouseXY shared
reg %ax,&H0003
reg %bx,0
call interrupt &H33
mouse.x=reg(%cx)
mouse.y=reg(%dx)
end sub
sub InitScreen(anz) shared
screen 12
reg %ax,&H10*256+&H10
reg %bx,0
reg %cx,&Haaaa
reg %dx,&Haa00
call interrupt &H10
reg %ax,&H10*256+&H10
reg %bx,7
reg %cx,0
reg %dx,0
call interrupt &H10
dim gad.x1(anz)
dim gad.x2(anz)
dim gad.y1(anz)
dim gad.y2(anz)
dim gad.x(anz)
dim gad.y(anz)
dim gad.w(anz)
dim gad.h(anz)
dim gad.text$(anz)
dim gad.flags(anz)
dim gad.selected(anz)
dim gad.number(anz)
gad.count=0
gad.max=anz
gad.id=-1
menu.id=-1
%GADGHNONE=1
%GADGHCOMP=2
%TOGGLESELECT=3
%MENUGAD=4
call DrawPBorder(5,1,74,1,"")
call BoolGadget(1,1,3,1,"",33333)
end sub
sub MouseHandler shared
gad.id=-1
if gad.count>0 then
for i=0 to gad.count-1
if mouse.x>=gad.x1(i) and mouse.x<=gad.x2(i) then
if mouse.y>=gad.y1(i) and mouse.y<=gad.y2(i) then
gad.id=i
call GadgetHandler
exit sub
end if
end if
next
end if
end sub
sub GadgetHandler shared
if gad.id=-1 then exit sub
if gad.flags(gad.id)=%GADGHCOMP then
call MouseOff
call DrawNBorder(gad.x(gad.id),gad.y(gad.id),gad.w(gad.id),gad.h(id),"")
call MouseOn
call MouseUp
while mouse.button=0
call MouseUp
wend
call MouseOff
call DrawPBorder(gad.x(gad.id),gad.y(gad.id),gad.w(gad.id),gad.h(id),"")
call MouseOn
i=gad.id
gad.id=-1
if mouse.x>=gad.x1(i) and mouse.x<=gad.x2(i) then
if mouse.y>=gad.y1(i) and mouse.y<=gad.y2(i) then
gad.id=i
end if
end if
elseif gad.flags(gad.id)=%MENUGAD then
call MouseUp
elseif gad.flags(gad.id)=%TOGGLESELECT then
call MouseUp
call MouseOff
if gad.selected(gad.id)=0 then
call DrawPBorder(gad.x(gad.id),gad.y(gad.id),gad.w(gad.id),gad.h(gad.id),"")
gad.selected(gad.id)=1
else
call DrawNBorder(gad.x(gad.id),gad.y(gad.id),gad.w(gad.id),gad.h(gad.id),"")
gad.selected(gad.id)=0
end if
call MouseOn
end if
end sub
sub BoolGadget(x,y,w,h,text$,id) shared
if gad.count>=gad.max then exit sub
gad.x(gad.count)=x
gad.y(gad.count)=y
gad.w(gad.count)=w
gad.h(gad.count)=h
gad.x1(gad.count)=x*8-2
gad.y1(gad.count)=y*16-6
gad.x2(gad.count)=gad.x1(gad.count)+(w*8)
gad.y2(gad.count)=gad.y1(gad.count)+(h*16)+4
gad.text$(gad.count)=text$
gad.flags(gad.count)=%GADGHCOMP
gad.selected(gad.count)=0
gad.number(gad.count)=id
gad.count=gad.count+1
call DrawPBorder(x,y,w,h,text$)
end sub
sub ToggleGadget(x,y,w,h,text$,selected,id) shared
if gad.count>=gad.max then exit sub
gad.x(gad.count)=x
gad.y(gad.count)=y
gad.w(gad.count)=w
gad.h(gad.count)=h
gad.x1(gad.count)=x*8-2
gad.y1(gad.count)=y*16-6
gad.x2(gad.count)=gad.x1(gad.count)+(w*8)
gad.y2(gad.count)=gad.y1(gad.count)+(h*16)+4
gad.text$(gad.count)=text$
gad.flags(gad.count)=%TOGGLESELECT
gad.selected(gad.count)=selected
gad.number(gad.count)=id
gad.count=gad.count+1
if selected=0 then
call DrawNBorder(x,y,w,h,text$)
else
call DrawPBorder(x,y,w,h,text$)
end if
end sub
sub RemoveGadget(num) shared
call MouseOff
if gad.flags(num)<>%MENUGAD then
line (gad.x1(num),gad.y1(num))-(gad.x2(num)+1,gad.y2(num)+2),0,bf
else
locate gad.y(num)+1,gad.x(num)+1
color 0
print gad.text$(num)
end if
call MouseOn
if gad.count<gad.max then
for i=num to gad.max-1
gad.x1(i)=gad.x1(i+1)
gad.x2(i)=gad.x2(i+1)
gad.y1(i)=gad.y1(i+1)
gad.y2(i)=gad.y2(i+1)
gad.x(i)=gad.x(i+1)
gad.y(i)=gad.y(i+1)
gad.w(i)=gad.w(i+1)
gad.h(i)=gad.h(i+1)
gad.text$(i)=gad.text$(i+1)
gad.flags(i)=gad.flags(i+1)
gad.selected(i)=gad.selected(i+1)
gad.number(i)=gad.number(i+1)
next
end if
gad.count=gad.count-1
end sub
sub MenuGadget(x,text$,id) shared
if gad.count>=gad.max then exit sub
y=1
h=1
w=len(text$)
gad.x(gad.count)=x
gad.y(gad.count)=y
gad.w(gad.count)=w
gad.h(gad.count)=h
gad.x1(gad.count)=x*8-2
gad.y1(gad.count)=y*16-6
gad.x2(gad.count)=gad.x1(gad.count)+(w*8)
gad.y2(gad.count)=gad.y1(gad.count)+(h*16)+4
gad.text$(gad.count)=text$
gad.flags(gad.count)=%MENUGAD
gad.selected(gad.count)=0
gad.number(gad.count)=id
gad.count=gad.count+1
locate y+1,x+1
print text$
end sub
sub MenuHandler(x,w,feld$(),anz) shared
ax1=x*8
ay1=30
ax2=ax1+w
ay2=ay1+(anz*16)+8
size&=(ax2-ax1)*(ay2-ay1)/2
dim backup%(size&)
call MouseOff
get (ax1,ay1)-(ax2,ay2),backup%
line (ax1,ay1)-(ax2,ay2),0,bf
line (ax1,ay2)-(ax1,ay1),15
line -(ax2,ay1),15
line (ax1+1,ay2)-(ax2,ay2),7
line -(ax2,ay1+1),7
color 15
for i=0 to anz-1
if feld$(i)="-" then
ty=(3+i)*16-8
line (ax1+1,ty)-(ax2-1,ty),15
elseif right$(feld$(i),1)=chr$(0) then
color 3
locate 3+i,x+3
print feld$(i)
else
color 15
locate 3+i,x+3
print feld$(i)
end if
next
call MouseOn
call MouseUp
while mouse.button=0
call MouseUp
wend
of=-1
call MouseDown
while mouse.button=0
call MouseXY
if mouse.x>ax1 and mouse.x<ax2 then
y=int(mouse.y/16)+1
if y>=3 and y<3+anz then
if of<>y-3 then
if of<>-1 then
call MouseOff
color 15
locate oy,ox
print feld$(of)
call MouseOn
end if
if feld$(y-3)<>"-" and right$(feld$(y-3),1)<>chr$(0) then
oy=y
ox=x+3
of=y-3
call MouseOff
color 12
locate oy,ox
print feld$(of)
call MouseOn
else
of=-1
end if
call MouseOn
end if
else
if of<>-1 then
call MouseOff
color 15
locate oy,ox
print feld$(of)
call MouseOn
of=-1
end if
end if
end if
call MouseDown
wend
y=int(mouse.y/16)+1
menu.id=-1
if y>=3 and y<3+anz and mouse.x>ax1 and mouse.x<ax2 then
if feld$(y-3)<>"-" and right$(feld$(y-3),1)<>chr$(0) then
menu.id=y-3
if mid$(feld$(menu.id),1,1)=" " then
mid$(feld$(menu.id),1,1)=chr$(251)
elseif mid$(feld$(menu.id),1,1)=chr$(251) then
mid$(feld$(menu.id),1,1)=" "
end if
end if
end if
call MouseOff
put (ax1,ay1),backup%,pset
erase backup%
call MouseOn
end sub
function ToggleMenuStatus(titel$) static
if mid$(titel$,1,1)=" " then
ToggleMenuStatus=0
elseif mid$(titel$,1,1)=chr$(251) then
ToggleMenuStatus=1
else
ToggleMenuStatus=-1
end if
end function
sub SetToggleMenu(titel$,onoff) static
if onoff=1 then c$=chr$(251) else c$=" "
mid$(titel$,1,1)=c$
end sub
sub ItemOn(titel$) static
if right$(titel$,1)=chr$(0) then
mid$(titel$,len(titel$),1)=" "
end if
end sub
sub ItemOff(titel$) static
if right$(titel$,1)<>chr$(0) then
titel$=titel$+chr$(0)
elseif right$(titel$,1)=" " then
mid$(titel$,len(titel$),1)=chr$(0)
end if
end sub